<template>
  <el-menu
    class="categories"
    default-active="0"
    @select="handleSelect"
    active-text-color="red">
    <el-menu-item index="0">
      <i class="el-icon-menu"></i>
<!--        <el-icon></el-icon>-->
<!--     slot="title"   -->
      <span >全部</span>
    </el-menu-item>
    <el-menu-item index="1">
      <i class="el-icon-menu"></i>
<!--     slot="title"   -->
      <span >文学</span>
    </el-menu-item>
    <el-menu-item index="2">
      <i class="el-icon-menu"></i>
<!--     slot="title"   -->
      <span >流行</span>
    </el-menu-item>
    <el-menu-item index="3">
      <i class="el-icon-menu"></i>
<!--     slot="title"   -->
      <span >文化</span>
    </el-menu-item>
    <el-menu-item index="4">
      <i class="el-icon-menu"></i>
<!--     slot="title"   -->
      <span >生活</span>
    </el-menu-item>
    <el-menu-item index="5">
      <i class="el-icon-menu"></i>
<!--      slot="title"  -->
      <span >经管</span>
    </el-menu-item>
    <el-menu-item index="6">
      <i class="el-icon-menu"></i>
<!--      slot="title"  -->
      <span >科技</span>
    </el-menu-item>
  </el-menu>
</template>

<script>
    import {getCurrentInstance, reactive, toRefs} from "vue";

    export default {
      name: 'SideMenu',
        setup(){
          const data = reactive({
              cid: ''
          })

            let {proxy} = getCurrentInstance();

            function handleSelect (key, keyPath) {
                console.log(keyPath)
                data.cid = key
                proxy.$emit('indexSelect')
            }
            return {
                ...toRefs(data),
                handleSelect
            }
        }


    }
</script>

<style scoped>
  .categories {
    position: fixed;
    margin-left: 50%;
    left: -600px;
    top: 100px;
    width: 150px;
  }
</style>
